<?php
	include('include/configs.inc.php');
	
	$pays = $_POST['pays'];
	$ville = $_POST['ville'];
	$type = $_POST['type'];
	$tarif = $_POST['tarif'];
	$error = '';
	
	$sql = "SELECT b.description, b.id AS pid, p.url AS url FROM bien b INNER JOIN photo p ON b.id_photo=p.id WHERE b.ville='".$ville."' AND b.id_type_bien='".$type."'";
	
	if(!empty($_POST['surface'])) {
		$surface = $_POST['surface'];
		$sql .= " AND b.surface='".$surface."' ";
	}
	
	if(!empty($_POST['tarif'])) {
		$tarif = $_POST['tarif'];
		$sql .= "AND b.prix_journee > ".$tarif." OR b.prix_semaine > ".$tarif;
	}
	
	if($query = $connect->query($sql)) {
		if($query->num_rows < 1) {
			$error = "Aucun r&eacute;sultat !";
		}
	} else {
		echo $connect->error;
	}
		
	include('template/Site_reservation.html');
?>